﻿using System;
using System.IO;

namespace UDS.Management.Data.Package
{
    public class ScriptSource : IDisposable
    {
        private string _name;
        private Stream _stream;

        public ScriptSource()
        { }

        public ScriptSource(string name, Stream stream)
        {
            Initialize(name, stream);
        }

        internal virtual void Initialize(string name, Stream stream)
        {
            this._name = name;
            this._stream = stream;
        }

        /// <summary>
        /// The name of the script.  It can be a file path or a resource path depending
        /// on the source of the script.
        /// </summary>
        public string Name
        {
            get { return _name; }
        }

        public Stream Stream
        {
            get { return _stream; }
        }

        #region IDisposable Members

        public virtual void Dispose()
        {
            if (_stream != null)
            {
                _stream.Dispose();
            }
        }

        #endregion
    }
}
